home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Contributed / SpriteWorld / SpriteWorld Files / MPW / NewBuild < prev    next >
Encoding:
Text File  |  2000-10-06  |  1.3 KB  |  53 lines  |  [TEXT/MPS ]

  1. #    NewBuild - build the specified project
  2. #
  3. #    Usage:
  4. #        NewBuild program [options…] > log
  5. #
  6. #    The NewBuild script builds the specified program (or target).
  7. #
  8. #    Make is used to generate the build commands.  If file <program>.make
  9. #    exists it is used as the makefile.    If not, file MakeFile is used.
  10. #
  11. #    The options specified are passed directly to Make, and control the
  12. #    generation of the build commands.
  13. #
  14. #    Modified from BuildProgram, to create the object folders
  15.  
  16. Set Exit 1
  17.  
  18. #    Find the program parameter.
  19. Unset program
  20. For i In {"Parameters"}
  21.     If "{i}" !~ /-≈/
  22.         Set program "{i}"
  23.         Break
  24.     End
  25. End
  26. If "{program}" == ""
  27.     Echo "### {0} - Specify a program to build." > Dev:StdErr
  28.     Echo "# Usage - {0} program [options…]" > Dev:StdErr
  29.     Exit 1
  30. End
  31.  
  32. #    Select the makefile.
  33. Set makefile `(Files -t TEXT "{program}".make || ∂
  34.     Files -t TEXT MakeFile || Echo '""') ≥ Dev:Null`
  35. If "{makefile}" == ""
  36.     Echo "### {0} - No makefile exists for {program}." > Dev:StdErr
  37.     Exit 1
  38. End
  39.  
  40. # Create the object code folder (if necessary)
  41. if !`Exists -d ":Objects:"`
  42.     NewFolder Objects
  43. End
  44. if !`Exists -d ":DebugObjects:"`
  45.     NewFolder DebugObjects
  46. End
  47.  
  48. #    Run Make, then execute its output.
  49. Make {"Parameters"} -f "{makefile}" > "{program}".makeout
  50. Execute "{program}".makeout > Dev:StdErr # > "{program}.makeerr"
  51. Delete "{program}".makeout
  52. Echo "# Build done."
  53.